package com.bnz.service.impl;

import com.bnz.mapper.ClassesMapper;
import com.bnz.pojo.Classes;
import com.bnz.service.ClassesService;
import com.bnz.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class ClassesServiceImpl implements ClassesService {
    @Override
    public List<Classes> findAll() {
//        try(SqlSession sqlSession = MyBatisUtil.getSqlSession()){
//            ClassesMapper classesMapper = sqlSession.getMapper(ClassesMapper.class);
//            return classesMapper.findAll();
//        }
        try (SqlSession sqlSession = MyBatisUtil.getSqlSession()) {
            ClassesMapper mapper = sqlSession.getMapper(ClassesMapper.class);
            return mapper.findAll();
        }
    }
}
